package com.wzdigit.wms.basic.util;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * 获取session和对应session的属性值工具类
 * @author borui_zhuang
 *
 */
public class HttpSessionUtil {

	public static HttpSession getSession(HttpServletRequest request) {
		return request.getSession();
	}
	
	public static Object getSessionAttr(HttpServletRequest request, String name) {
		return getSession(request).getAttribute(name);
	}
	
	public static String getSessionAttrStr(HttpServletRequest request, String name) {
		return "" + getSession(request).getAttribute(name);
	}
	
	public static String getLoginName(HttpServletRequest request) {
		return getSessionAttrStr(request, "loginName");
	}
}
